package com.example.demo.controller;
/*
 * 李洲 2020030654A1213
 * 2024.05.24
 */
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/patterns")
public class PatternMatchingController {

    // 单字符匹配示例（匹配 /patterns/p1, /patterns/p2, 等）
    @GetMapping("/p?")
    public String singleCharacterMatch() {
        return "Single character match";
    }

    // 多字符匹配示例（匹配 /patterns/files, /patterns/file, /patterns/filessss, 等）
    @GetMapping("/file*")
    public String multipleCharacterMatch() {
        return "Multiple character match";
    }

    // 正则表达式匹配示例（匹配 /patterns/abc123, /patterns/xyz456, 等）
    @GetMapping("/regex/{id:[a-z]{3}[0-9]{3}}")
    public String regexMatch(@PathVariable String id) {
        return "Regex match: " + id;
    }
}
